Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resolver): use require.resolve.paths(); avoid require for json #1194

Merged
merged 4 commits into from
Apr 27, 2019

Conversation

midzelis
Copy link
Contributor

Details

  1. module.paths doesn't return look at NODE_PATH env var, whereas require.resolve.paths() will. This is needed for some scenarios where you need to change the NODE_PATH because of a npm link (or yarn link) where the node_modules directory tree isn't always part of the same file tree due to the symbolic link.
  2. using require() to load .json will permanently cache the package.json contents in memory, which in large dependency trees can take up a lot of space. Use fs.readFileSync() instead.

Does this PR introduce a breaking change?

  • Yes
  • No

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a429824 | Target commit: 0d2bf61

lwc-engine-benchmark

table-append-1k metric base(a429824) target(0d2bf61) trend
benchmark-table/append/1k duration 148.90 (±4.75 ms) 149.50 (±5.65 ms) +0.6ms (0.4%) 👌
table-clear-1k metric base(a429824) target(0d2bf61) trend
benchmark-table/clear/1k duration 11.40 (±0.55 ms) 11.40 (±0.60 ms) 0.0ms (0.0%) 👌
table-create-10k metric base(a429824) target(0d2bf61) trend
benchmark-table/create/10k duration 879.65 (±4.40 ms) 882.65 (±5.95 ms) +3.0ms (0.3%) 👎
table-create-1k metric base(a429824) target(0d2bf61) trend
benchmark-table/create/1k duration 118.35 (±2.75 ms) 119.60 (±3.20 ms) +1.3ms (1.1%) 👌
table-update-10th-1k metric base(a429824) target(0d2bf61) trend
benchmark-table/update-10th/1k duration 75.10 (±4.35 ms) 67.75 (±2.00 ms) -7.3ms (9.8%) 👍
tablecmp-append-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-component/append/1k duration 227.00 (±10.50 ms) 229.85 (±9.40 ms) +2.8ms (1.3%) 👌
tablecmp-clear-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-component/clear/1k duration 5.75 (±1.00 ms) 5.85 (±1.00 ms) +0.1ms (1.7%) 👌
tablecmp-create-10k metric base(a429824) target(0d2bf61) trend
benchmark-table-component/create/10k duration 1735.35 (±13.05 ms) 1708.40 (±12.10 ms) -26.9ms (1.6%) 👍
tablecmp-create-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-component/create/1k duration 209.80 (±6.35 ms) 211.60 (±5.00 ms) +1.8ms (0.9%) 👌
tablecmp-update-10th-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-component/update-10th/1k duration 65.30 (±5.55 ms) 65.95 (±4.30 ms) +0.6ms (1.0%) 👌
wc-append-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-wc/append/1k duration 224.00 (±20.85 ms) 233.60 (±14.95 ms) +9.6ms (4.3%) 👌
wc-clear-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-wc/clear/1k duration 11.35 (±1.40 ms) 10.70 (±1.40 ms) -0.7ms (5.7%) 👌
wc-create-10k metric base(a429824) target(0d2bf61) trend
benchmark-table-wc/create/10k duration 1841.40 (±21.85 ms) 1859.25 (±16.95 ms) +17.8ms (1.0%) 👎
wc-create-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-wc/create/1k duration 217.65 (±4.95 ms) 214.10 (±5.50 ms) -3.6ms (1.6%) 👌
wc-update-10th-1k metric base(a429824) target(0d2bf61) trend
benchmark-table-wc/update-10th/1k duration 65.65 (±4.20 ms) 64.90 (±3.65 ms) -0.8ms (1.1%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a257c23 | Target commit: 1e04c7b

lwc-engine-benchmark

table-append-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table/append/1k duration 146.70 (±3.55 ms) 146.20 (±3.65 ms) -0.5ms (0.3%) 👌
table-clear-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table/clear/1k duration 11.25 (±0.60 ms) 11.30 (±0.65 ms) +0.1ms (0.4%) 👌
table-create-10k metric base(a257c23) target(1e04c7b) trend
benchmark-table/create/10k duration 875.80 (±7.45 ms) 878.15 (±7.40 ms) +2.4ms (0.3%) 👌
table-create-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table/create/1k duration 118.45 (±2.80 ms) 119.80 (±2.25 ms) +1.3ms (1.1%) 👎
table-update-10th-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table/update-10th/1k duration 75.70 (±3.05 ms) 76.85 (±2.70 ms) +1.2ms (1.5%) 👌
tablecmp-append-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-component/append/1k duration 224.65 (±11.55 ms) 222.70 (±13.10 ms) -1.9ms (0.9%) 👌
tablecmp-clear-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-component/clear/1k duration 6.45 (±1.25 ms) 5.85 (±1.15 ms) -0.6ms (9.3%) 👌
tablecmp-create-10k metric base(a257c23) target(1e04c7b) trend
benchmark-table-component/create/10k duration 1725.80 (±13.10 ms) 1714.45 (±8.55 ms) -11.3ms (0.7%) 👍
tablecmp-create-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-component/create/1k duration 210.70 (±4.25 ms) 210.05 (±3.95 ms) -0.6ms (0.3%) 👌
tablecmp-update-10th-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-component/update-10th/1k duration 64.95 (±3.85 ms) 66.85 (±4.90 ms) +1.9ms (2.9%) 👌
wc-append-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-wc/append/1k duration 224.65 (±15.15 ms) 235.25 (±18.85 ms) +10.6ms (4.7%) 👌
wc-clear-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-wc/clear/1k duration 11.05 (±1.40 ms) 11.25 (±1.30 ms) +0.2ms (1.8%) 👌
wc-create-10k metric base(a257c23) target(1e04c7b) trend
benchmark-table-wc/create/10k duration 1820.10 (±21.50 ms) 1866.45 (±27.40 ms) +46.4ms (2.5%) 👎
wc-create-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-wc/create/1k duration 213.30 (±6.45 ms) 213.25 (±6.10 ms) -0.1ms (0.0%) 👌
wc-update-10th-1k metric base(a257c23) target(1e04c7b) trend
benchmark-table-wc/update-10th/1k duration 66.10 (±4.10 ms) 67.05 (±5.45 ms) +1.0ms (1.4%) 👌

Copy link
Contributor

@diervo diervo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change ignorePattern to ignorePatterns to be consistent

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a257c23 | Target commit: 900dc4e

lwc-engine-benchmark

table-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/append/1k duration 146.70 (±3.55 ms) 150.40 (±4.60 ms) +3.7ms (2.5%) 👎
table-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/clear/1k duration 11.25 (±0.60 ms) 11.30 (±0.70 ms) +0.1ms (0.4%) 👌
table-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table/create/10k duration 875.80 (±7.45 ms) 894.75 (±7.55 ms) +19.0ms (2.2%) 👎
table-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/create/1k duration 118.45 (±2.80 ms) 117.50 (±2.40 ms) -1.0ms (0.8%) 👌
table-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/update-10th/1k duration 75.70 (±3.05 ms) 68.75 (±1.70 ms) -6.9ms (9.2%) 👍
tablecmp-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/append/1k duration 224.65 (±11.55 ms) 226.20 (±8.25 ms) +1.6ms (0.7%) 👌
tablecmp-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/clear/1k duration 6.45 (±1.25 ms) 5.25 (±1.05 ms) -1.2ms (18.6%) 👌
tablecmp-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/create/10k duration 1725.80 (±13.10 ms) 1709.70 (±13.30 ms) -16.1ms (0.9%) 👍
tablecmp-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/create/1k duration 210.70 (±4.25 ms) 213.45 (±5.80 ms) +2.8ms (1.3%) 👌
tablecmp-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/update-10th/1k duration 64.95 (±3.85 ms) 62.55 (±4.30 ms) -2.4ms (3.7%) 👌
wc-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/append/1k duration 224.65 (±15.15 ms) 230.15 (±15.30 ms) +5.5ms (2.4%) 👌
wc-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/clear/1k duration 11.05 (±1.40 ms) 10.60 (±1.50 ms) -0.5ms (4.1%) 👌
wc-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/create/10k duration 1820.10 (±21.50 ms) 1848.70 (±20.25 ms) +28.6ms (1.6%) 👎
wc-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/create/1k duration 213.30 (±6.45 ms) 215.45 (±4.80 ms) +2.1ms (1.0%) 👌
wc-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/update-10th/1k duration 66.10 (±4.10 ms) 66.25 (±4.90 ms) +0.2ms (0.2%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a257c23 | Target commit: 900dc4e

lwc-engine-benchmark

table-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/append/1k duration 146.70 (±3.55 ms) 148.00 (±3.55 ms) +1.3ms (0.9%) 👌
table-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/clear/1k duration 11.25 (±0.60 ms) 11.25 (±0.75 ms) 0.0ms (0.0%) 👌
table-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table/create/10k duration 875.80 (±7.45 ms) 880.35 (±6.95 ms) +4.6ms (0.5%) 👌
table-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/create/1k duration 118.45 (±2.80 ms) 118.55 (±2.90 ms) +0.1ms (0.1%) 👌
table-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table/update-10th/1k duration 75.70 (±3.05 ms) 69.95 (±1.85 ms) -5.7ms (7.6%) 👍
tablecmp-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/append/1k duration 224.65 (±11.55 ms) 226.35 (±8.25 ms) +1.7ms (0.8%) 👌
tablecmp-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/clear/1k duration 6.45 (±1.25 ms) 6.10 (±1.00 ms) -0.3ms (5.4%) 👌
tablecmp-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/create/10k duration 1725.80 (±13.10 ms) 1738.15 (±12.85 ms) +12.4ms (0.7%) 👎
tablecmp-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/create/1k duration 210.70 (±4.25 ms) 210.45 (±5.75 ms) -0.3ms (0.1%) 👌
tablecmp-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-component/update-10th/1k duration 64.95 (±3.85 ms) 68.40 (±5.05 ms) +3.5ms (5.3%) 👎
wc-append-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/append/1k duration 224.65 (±15.15 ms) 228.15 (±15.35 ms) +3.5ms (1.6%) 👌
wc-clear-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/clear/1k duration 11.05 (±1.40 ms) 11.45 (±1.25 ms) +0.4ms (3.6%) 👌
wc-create-10k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/create/10k duration 1820.10 (±21.50 ms) 1887.40 (±20.65 ms) +67.3ms (3.7%) 👎
wc-create-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/create/1k duration 213.30 (±6.45 ms) 214.10 (±5.30 ms) +0.8ms (0.4%) 👌
wc-update-10th-1k metric base(a257c23) target(900dc4e) trend
benchmark-table-wc/update-10th/1k duration 66.10 (±4.10 ms) 66.85 (±4.45 ms) +0.8ms (1.1%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a257c23 | Target commit: baeb2a5

lwc-engine-benchmark

table-append-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table/append/1k duration 146.70 (±3.55 ms) 150.20 (±5.65 ms) +3.5ms (2.4%) 👎
table-clear-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table/clear/1k duration 11.25 (±0.60 ms) 11.50 (±0.75 ms) +0.3ms (2.2%) 👌
table-create-10k metric base(a257c23) target(baeb2a5) trend
benchmark-table/create/10k duration 875.80 (±7.45 ms) 875.90 (±6.55 ms) +0.1ms (0.0%) 👌
table-create-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table/create/1k duration 118.45 (±2.80 ms) 118.85 (±2.35 ms) +0.4ms (0.3%) 👌
table-update-10th-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table/update-10th/1k duration 75.70 (±3.05 ms) 66.80 (±2.05 ms) -8.9ms (11.8%) 👍
tablecmp-append-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-component/append/1k duration 224.65 (±11.55 ms) 230.95 (±8.80 ms) +6.3ms (2.8%) 👎
tablecmp-clear-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-component/clear/1k duration 6.45 (±1.25 ms) 6.05 (±1.10 ms) -0.4ms (6.2%) 👌
tablecmp-create-10k metric base(a257c23) target(baeb2a5) trend
benchmark-table-component/create/10k duration 1725.80 (±13.10 ms) 1733.20 (±17.45 ms) +7.4ms (0.4%) 👌
tablecmp-create-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-component/create/1k duration 210.70 (±4.25 ms) 212.30 (±5.80 ms) +1.6ms (0.8%) 👌
tablecmp-update-10th-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-component/update-10th/1k duration 64.95 (±3.85 ms) 65.05 (±4.05 ms) +0.1ms (0.2%) 👌
wc-append-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-wc/append/1k duration 224.65 (±15.15 ms) 226.30 (±17.20 ms) +1.7ms (0.7%) 👌
wc-clear-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-wc/clear/1k duration 11.05 (±1.40 ms) 11.35 (±1.40 ms) +0.3ms (2.7%) 👌
wc-create-10k metric base(a257c23) target(baeb2a5) trend
benchmark-table-wc/create/10k duration 1820.10 (±21.50 ms) 1875.00 (±19.25 ms) +54.9ms (3.0%) 👎
wc-create-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-wc/create/1k duration 213.30 (±6.45 ms) 215.40 (±5.30 ms) +2.1ms (1.0%) 👌
wc-update-10th-1k metric base(a257c23) target(baeb2a5) trend
benchmark-table-wc/update-10th/1k duration 66.10 (±4.10 ms) 67.60 (±4.25 ms) +1.5ms (2.3%) 👌

@midzelis midzelis requested a review from diervo April 26, 2019 23:05
@diervo diervo merged commit 7ef45df into master Apr 27, 2019
@diervo diervo deleted the midzelis/resolver branch April 27, 2019 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants